function Full_Welfare

clear
load results.mat

clearvars snPass

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;
% Updated Model, (T known, theta) 8/22/14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;

% Cost parameters (in thousand Kwacha);
cp.alpha  = 48;           % Public benefit per tree;
cp.eta    = 1.2;          % Cost of public funds;
cp.mon    = 35;           % Monitoring cost;
cp.cb     = (1/(1+0.03)); % Cost of borrowing;

% Run parameters, tolerance is unchanged
rp.parl    = 0;
rp.m       = 500; %(m=500 in zambia_main)
rp.k       = 1;
rp.lam     = 0;
rp.theseed = rp.theseed+1000;


rng(rp.theseed);
snPass.s       = rand(obs*(3*rp.k + rp.m),1);

% These two lines create a (k x m x 51) matrix, where the first floor is a
% (k x m) matrix of ones, the second a (k x m) matrix of twos, up to 51;
% Nv is just N repeated k x 51 times;
% the fourth and fifth are true false matrices for N vs. Nbar;
Ntr            = permute(N,[3,1,2]);
snPass.N3D     = Ntr(ones(rp.k,1),ones(rp.m,1),:);
snPass.Nv      = N(ones(rp.k,1),:);
snPass.Ngeq3D  = (snPass.N3D>=Nbar);
snPass.N03D    = (snPass.N3D>0);
snPass.Ngeqv   = (snPass.Nv>=Nbar);
snPass.N0v     = (snPass.Nv>0);

%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1) Post-Estimation, for use in Stata-run regressions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[PartProb,Npdf,Nobs,Prof1,Prof0,EN,OV,Prof0_C] = Full_Simulate(coefftran(theta_hat,0),DP,A,R,TG,MON,snPass,rp);

simdata=[A,R,PartProb,Nobs,Prof0,Prof1,TG,MON];
save 'zambia_simdata.mat' 'simdata'



%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LEAVE EVERYTHING ELSE FOR LATER














